import { useDict } from '/@/hooks/dict';
const { yes_no_type } = useDict('yes_no_type'); //是否字典
const { enterprise_types } = useDict('enterprise_types'); //企业类型
const { enterprise_scales } = useDict('enterprise_scales'); //企业规模
const { procurement_method } = useDict('procurement_method'); //采购方式
const { app_project_type } = useDict('app_project_type'); //应用开发类型
const { log_statuso } = useDict('log_statuso'); //验收状态
const { log_statust } = useDict('log_statust'); //实施状态
const { terminal } = useDict('terminal'); //应用发布端

export default {
	isYN: (data) => {
		if (!data) {
			return;
		}
		let zhi = '';
		yes_no_type.value.forEach((item) => {
			if (item.value == data) {
				zhi = item.label;
			}
		});
		return zhi;
	},
	enterpriseTypes: () => {
		return enterprise_types.value;
	},
	enterpriseScales: () => {
		return enterprise_scales.value;
	},
	localEnterprise: () => {
		return yes_no_type.value;
	},
	procurementMethod: () => {
		return procurement_method.value;
	},
	procurementMethods: (data) => {
		//采购方式显示
		if (!data) {
			return;
		}
		let rea = '';
		procurement_method.value.forEach((item) => {
			if (item.value == data) {
				rea = item.label;
			}
		});
		return rea;
	},
	//企业规模
	enterpriseScale: (data) => {
		if (!data) {
			return;
		}
		let rea = '';
		enterprise_scales.value.forEach((item) => {
			if (item.value == data) {
				rea = item.label;
			}
		});
		return rea;
	},
	enterpriseType: (data) => {
		if (!data) {
			return;
		}
		let rea = '';
		enterprise_types.value.forEach((item) => {
			if (item.value == data) {
				rea = item.label;
			}
		});
		return rea;
	},
	projectType: (data) => {
		if (!data) {
			return;
		}
		let rea = '';
		app_project_type.value.forEach((item) => {
			if (item.value == data) {
				rea = item.label;
			}
		});
		return rea;
	},
	//验收状态字典。。实施，变更
	logStatus: (data, arrData) => {
		let rea = '';
		//已经验收了
		if (arrData.checkFlag == '1') {
			log_statuso.value.forEach((item) => {
				if (item.value == arrData.logStatus) {
					rea = item.label;
				}
			});
			return rea;
		} else {
			//还未验收
			log_statust.value.forEach((item) => {
				if (item.value == arrData.logStatus) {
					rea = item.label;
				}
			});
			return rea;
		}
	},
	terminal: (data) => {
		if (!data) {
			return;
		}
		let arr = data.split(',');
		// let datas = ['', '渝快政', '渝快办', '支付宝', '微信', '网页', 'PC客户端'];
		let zhi = [];
		arr.forEach((item) => {
			terminal.value.forEach((it) => {
				if (it.value == item) {
					zhi.push(it.label);
				}
			});
		});

		return zhi.join(',');
	},
	belongArea: (data) => {
		if (!data) {
			return;
		}
		switch (data) {
			case '7':
				return '基层智治';
			case '6':
				return '数字法制';
			case '5':
				return '数字文化';
			case '4':
				return '数字社会';
			case '3':
				return '数字经济';
			case '2':
				return '数字政务';
			case '1':
				return '数字党建';
			default:
				break;
		}
	},
};
